#include "threadpool.h"
#include <stdio.h>

void fun(void* arg) {
  int i = 3;
  while(i--) {
    printf("hello, I'm %d\n", (int)arg);
    sleep(10);
  }
}

int main() {
  printf("main pid : %d\n", getpid());
  struct threadpool *tp = threadpool_init(30);
  int i;
  for (i = 0; i < 30; ++i) {
    threadpool_add_job(tp, fun, (void*)i);
  }
  threadpool_destroy(tp);
  while(1) {
    puts(".");
    sleep(3);
  }
  return 0;
}
